#include <iostream>

#include "Case1.h"


using namespace std;
using namespace cs;

int aa;
string ss;

class TestObj{

public: 
	virtual void update() {
		int i = 0;
		i += (rand() % 100);
		new TestObj();
	}

};

class TestObj1 : public TestObj {

public:
	void update() {
		TestObj::update();
		int i = 0;
		for (int a = 0; a < 1000; a++) {
			i += (rand() % 100);
		}
	}

};

void update() {
	int i = 0;
	i += (rand() % 100);
	new TestObj();
}

int main() {
	
	srand(time(0));

	TestObj objs[250000];
	for (int i = 0; i < 100000; ++i) {
		TestObj1 obj;
		objs[i+1] = obj;
	}

	time_t time1, time2;
	time(&time1);

	for (TestObj obj : objs) {
		obj.update();
	}

	time(&time2);

	cout << (time2 - time1) << endl;

	time(&time1);
	for (int i = 0; i < 100000; ++i) {
		update();
	}
	time(&time2);
	cout << (time2 - time1) << endl;

	time(&time1);
	long ii = 0;
	for (int i = 0; i < 100000; ++i) {
		for (int j = 0; j < 1000; ++j) {
			ii += (rand() % 100);
		}
		new TestObj();
	}
	time(&time2);
	cout << (time2 - time1) << " " << ii << endl;


	//cout << aa << endl;
	//cout << ss << endl;
	//int aaa = aa;
	//string sss;
	//cout << aaa << endl;
	//cout << sss << endl;


	//Case1 ca1 = Case1(112, "测试赋值");
	//Case1 ca2(112, "测试赋值");

	//ca1.show();
	//ca2.show();
	//ca1.show1();
	//ca2.aaa = "sss111";
	//ca2.show1();

	//cout << ca1.aaa << endl;
	//cout << ca2.aaa << endl;
	////TEST_SHOW("sssss");

	return 0;
}